#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：16.单继承.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-10-22 15:18
'''
class Anmia():
    def eat(self):
        print("吃饭...")

    def drink(self):
        print("喝水...")

    def sleep(self):
        print("睡觉...")

    # def print_info(self):
    #     print(self)
    #     print(f'{self.name}, {self.age}')

class Dog(Anmia):
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def print_info(self):
        print(self)
        print(f'{self.name}, {self.age}')
    pass

# 如果有继承关系的父类，不可修改父类的方法和属性
dog = Dog('来福', 2)
dog.eat()
dog.drink()
dog.sleep()
dog.print_info()

print("*" * 50)
int_data = 1
# isinstance 判断一个实例是否属于这个类或者子类
print(isinstance(int_data, str))
print(isinstance(dog, Anmia))

print("*" * 50)
# issubclass 判断Dog是否属性Anmia的子类
print(issubclass(Dog, Anmia))
print(issubclass(Anmia, Dog))
